home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
COMMUNIC
/
H191.ZIP
/
CA29-3.EXE
/
LEARN.DOC
< prev
next >
Wrap
Text File
|
1992-11-30
|
21KB
|
825 lines
COM-AND LEARN Script
---------------------------------------
COM-AND LEARN Script
Script generator (learning) for COM-AND
---------------------------------------
COM-AND, and the LEARN script are copyright 1992 by CABER Soft-
ware. COM-AND is distributed freely and may be copied by anyone
for any number of machines, for purposes of evaluation. The
author offers COM-AND and its accessory programs as "shareware".
If you USE the program after evaluating it, you MUST pay for it.
The complete user license and registration information is to be
found in the file REGISTER.DOC. Limitations on redistribution
of COM-AND are set out in the file VENDOR.DOC. These two files
are included with the COM-AND program release.
CABER Software
R. (Scott) McGinnis
P.O. Box 3607 Mdse Mart
Chicago, IL 60654-0607
GEnie, Delphi: TARTAN
CIS .......... 73147,2665
Internet ..... 73147.2665@compuserve.com
Version 1.0: 921012
COM-AND LEARN Script
Table of Contents
-----------------
I. Introduction .............................................. page 1
A. What is COM-AND? ........................................ page 1
B. The LEARN script ........................................ page 1
II. Running LEARN .............................................. page 2
III. LEARN function ............................................. page 3
IV. LEARN commands ............................................. page 6
ESC Exit LEARN ......................................... page 6
F1 Load accessory ..................................... page 6
F2 Execute script ..................................... page 6
F3 Change drive:subdir ................................ page 6
F4 Set default download subdir ........................ page 6
F5 Toggle line/char ................................... page 7
F6 Toggle learn hold .................................. page 7
F7 Toggle logging file ................................ page 7
F9 Toggle log hold .................................... page 7
F10 Information screen ................................. page 7
Alt-C Clear screen ....................................... page 8
Alt-E Toggle echo ........................................ page 8
Alt-D Dial ............................................... page 8
Alt-G Toggle blankline ................................... page 8
Alt-H Hangup ............................................. page 8
Alt-L Toggle 25/43 ....................................... page 8
Alt-Q Toggle CR/CRLF ..................................... page 8
Alt-N Encrypt/decrypt .................................... page 9
Alt-P Set comm parms ..................................... page 9
Alt-Z Toggle masking ..................................... page 9
PgUp Upload ............................................. page 9
PgDn Download ........................................... page 10
Alt-F10 Shell to DOS ....................................... page 10
Alt-0/9 Send macro ......................................... page 10
Ctl-End Send break ......................................... page 10
Ctl-Prt Toggle print ....................................... page 10
V. Modifying Scripts .......................................... page 11
VI. Program Requirements ....................................... page 12
VII. Program and Author Information ............................ page 13
Version 1.0: 921012
COM-AND LEARN Script Page 1
I. Introduction
A. What is COM-AND?
COM-AND for the IBM PC and compatibles is a communications
program for use by itself, or for use with several integrated
accessory programs (which themselves may be used independently of
COM-AND). COM-AND provides standard comm program functions: a
dialing directory, macros, disk logging, binary and ASCII file
transfers, scripted execution and the usual schtick.
B. The LEARN script
LEARN.CMD was created at Mike Todd's request, to aid in the
writing of scripts. LEARN generates a script by 'comprehending'
(in a limited sense) the actions taken. The generated script
mimics the learned session. LEARN provides many COM-AND functions
(e.g. DIAL (Alt-D), Accessories (F1) macros (Alt-0/9), and so on)
within its environment.
This document discusses the function of the LEARN.CMD script.
Version 1.0: 921012
COM-AND LEARN Script Page 2
II. Running LEARN
The LEARN script is invoked through COM-AND's script processor (F2).
When invoked, LEARN first asks for a script file name. When this
request is satisfied, LEARN then displays a screen with:
. a received text area
. a keyboard buffer
. a summary of available commands
. a status line
The LEARN script adjusts to the screen size in use. You may wish to
use LEARN in 43 line mode generally (if you have an EGA or VGA adap-
tor), to provide a maximum space for received text.
LEARN logs the initial state of COM-AND (options, comm parms, and so
on) to the output file when the file is created. If you enter LEARN
with 43 screen lines, a SET 43 is placed at the beginning of the
output file. You may edit this out after exiting LEARN, or during
the LEARN session.
Note: any subdirectory/drive change you perform within LEARN is
'cancelled' when you exit LEARN. Similarly, the screen from which
LEARN was executed is restored.
Version 1.0: 921012
COM-AND LEARN Script Page 3
III. LEARN function
LEARN follows your actions. When a key is pressed, its equivalent
is displayed in the keyboard display. When RETURN is pressed, the
entire line (limited to 60 characters) is transmitted, and WAITFOR/
TRANSMIT statements are written to the output file. For example:
WAITFOR "<last received text>"
;*IF NOT WAITFOR GOTO ...
TRANSMIT "<what was typed>"
LEARN writes a WAITFOR, a comment, and a TRANSMIT statement to the
output file. The WAITFOR waits for the last line of text received.
The comment is to remind the potential author that the WAITFOR may
time out, and the action should be tested. The TRANSMIT sends the
equivalent of what was typed out the comm port.
Should no text have been received between the last transmit and the
current transmit, LEARN write the following comments to the output
file:
;
; WAITFOR may be needed here
;
Initially, LEARN is in a 'LINE' mode. Text is buffered, and trans-
mitted only when RETURN is pressed. Some BBSes use single characters
and control characters as commands. LEARN may set to a 'character'
mode with the F5 toggle (see below). In 'CHAR' mode, each character
typed results in the WAITFOR/comment/TRANSMIT statements described
above.
Special functions (such as Alt-D dialing, macros, and so on) may be
performed within LEARN. The appropriate script statements are added
to the output file. The special functions LEARN supports are listed
in the following chapter.
When LEARN is exited, the output file is closed, and COM-AND is reset
to a condition similar to that when LEARN was entered. The real work
starts when LEARN is exited and you must edit the script!
Version 1.0: 921012
COM-AND LEARN Script Page 4
III. LEARN function (continued)
LEARN cannot capture some actions taken on-line. For example, when
dialing PLINK direct, connecting to PLINK's modems requires one step
LEARN cannot accomodate. For example:
... initial state settings
LEGEND "Script learned: "*"08/10/1989"
PRINTER OFF
SET CHAT OFF
SET KBDB OFF
; Dialing
DIAL "1"
IF FAILED
EXIT
ENDIF
WAITFOR "2400"
;*IF NOT WAITFOR GOTO ...
TRANSMIT "!"
;
; WAITFOR may be needed here
;
TRANSMIT "!"
WAITFOR "USER ID:"
;*IF NOT WAITFOR GOTO ...
TRANSMIT "id!"
WAITFOR "PASSWORD:"
;*IF NOT WAITFOR GOTO ...
TRANSMIT "password!"
... and so on
The above script was generated by entering LEARN, pressing Alt-D,
selecting entry #1, pressing CR twice, and typing "id" followed by
"password". When this script is executed, it does not connect.
PLINK's modems require a 5 second pause between the time the local
modem reports carrier, and the first CR is pressed. The appropriate
script would be:
... as above
IF FAILED
EXIT
ENDIF
PAUSE 5 ; Added for PLINK's modems
TRANSMIT "!"
TRANSMIT "!"
WAITFOR "USER ID:"
... and so on
Version 1.0: 921012
COM-AND LEARN Script Page 5
III. LEARN function (continued)
Further, many actions taken on-line are the result of 'decisions'.
A decision is made according to the last text received. For example,
logic to enter a file library and search for files with a certain
keyword may be captured directly by LEARN. However, the decision to
download none, or a file (or files) must be made on the response to
the search. LEARN does not capture alternatives (decision-making
logic). LEARN simply captures what happened as a script.
Extensive editing of the resultant script is recommended. LEARN
serves as a means to capture SOME of the actions taken on-line, and
as an aid to the process of script writing.
Version 1.0: 921012
COM-AND LEARN Script Page 6
IV. LEARN commands
ESC Exit LEARN
When you press ESC it may not take immediately. LEARN flags
the fact ESC was pressed, and acts upon it as soon as all
output is complete. When LEARN executes the ESC, a window
is raised to query 'are you sure?'. If the response is 'n',
LEARN continues. If the response is 'y', LEARN ends.
F1 Load accessory
LEARN pops-up a window to display the current accessory dir-
ectory. PgDn, PgUp, Home, and End scroll through the window.
To select an accessory, enter the number. After an accessory
is selected, LEARN warns you that execution of an accessory
terminates LEARN. An "ACCESSORY #" statement is added to the
output file, and the accessory is executed.
F2 Execute script
LEARN pops-up a window to request the name of a script file.
The script must exist. LEARN warns you that the invocation
of another script terminates LEARN. An "EXECUTE <script>"
statement is added to the output file, and the EXECUTE is
performed.
F3 Change drive:subdir
LEARN pops-up a window to request the drive:subdirectory.
A CHDIR function is performed on the response, and a "CHDIR"
statement is added to the output file.
Note: when LEARN terminates, the original drive:subdir is
restored. The LEARNed script, however, does not restore the
original subdirectory after IT executes.
F4 Set default download subdir
LEARN pops-up a window to request the drive:subdirectory.
A DLDIR function is performed on the response, and a "DLDIR"
statement is added to the output file.
Note: when LEARN terminates, the original drive:subdir is
restored.
Version 1.0: 921012
COM-AND LEARN Script Page 7
IV. LEARN commands (continued)
F5 Toggle line/char
Initially, LEARN is in 'line mode'. When characters (a-z,
1-9, etc) are typed, they echo in the keyboard box. When
RETURN is typed, the entire line is transmitted, and the
appropriate script statements are added to the output file.
The 'mode' may be switched to 'character', where each key-
stroke is transmitted when it is typed (and each keystroke
generates a WAITFOR/TRANSMIT command).
NOTE: The display doubles carets and exclamation points.
This is done to correctly TRANSMIT those characters.
F6 Toggle learn hold
The LEARN script may be put on HOLD with the F6 key. When
held, what is typed is sent, no script is generated, and no
functions are available.
F7 Toggle logging file
A transcript file may be turned on and off during the script.
When the log is turned on in LEARN, a file name is requested.
The file name given goes directly into the output script as
the name of the log file (in a "LOG OPEN" statement). NOTE:
You may wish to add a WAITFOR prior to the emitted LOG OPEN
and LOG CLOSE statements.
No initial setting of a transcript file is added at the start
of the output file. If LEARN is entered with logging on, and
the log isn't turned off or held during LEARN, no log state-
ments of any type are emitted to the output script.
F9 Toggle log hold
The transcript function may be suspended and resumed during
LEARN in the normal manner. LOG SUSPEND and LOG RESUME
statements are added to the output file. NOTE: You may wish
to add a WAITFOR prior to the emitted LOG SUSPEND and LOG
RESUME statements.
F10 Information screen
When F10 is pressed, the current screen is overlaid with a
few words about LEARN.
Version 1.0: 921012
COM-AND LEARN Script Page 8
IV. LEARN commands (continued)
Alt-C Clear screen
The receive area may be cleared (and cursor homed) in the
normal manner. A CLEAR statement is added to the output.
NOTE: You may wish to add a WAITFOR prior to the CLEAR.
Alt-E Toggle echo
The keyboard echo (a.k.a HALF and full duplex) may be toggled
in the normal manner. SET DUPLEX HALF and SET DUPLEX FULL
statements are added to the output file. LEARN itself pro-
vides a visible keyboard buffer, and the ECHO setting has no
effect on the script.
Alt-D Dial
LEARN pops-up a window to display the current dialing direc-
tory. PgDn, PgUp, Home, and End scroll through the window.
To select an entry to dial, enter the number. LEARN dials
the entry, and emits a DIAL paragraph to the output file.
Alt-G Toggle blankline
Blank-line suppression may be toggled in the normal manner.
SET BSUPPRESS ON and OFF statements are added to the output
file. Note: while LEARN is executing, blank line suppres-
sion does not visibly occur.
Alt-H Hangup
LEARN emits a WAITFOR/HANGUP to the output file, and then a
HANGUP in the normal manner.
Alt-L Toggle 25/43
LEARN switches between 43 and 25 line modes on Alt-L. A
SET 43 or SET 25 is added to the output file.
Alt-Q Toggle CR/CRLF
LEARN provides a toggle for CR/CRLF (which doesn't occur as
a toggle in COM-AND), as it is useful in some instances...
Alt-Q toggles the interpretation of CR received (as either
CR or CRLF). The appropriate SET CR statement is emitted.
Version 1.0: 921012
COM-AND LEARN Script Page 9
IV. LEARN commands (continued)
Alt-N Encrypt/decrypt
LEARN pops-up a window to allow selection of DES/Simple en-
cryption, or decryptions. [Note: one-way encryption for
scripts is not available as an option here.] To select a
function, enter the number. LEARN queries for source, des-
tination file names, and the password. The source file must
exist. If the function is successful, the following is
emitted to the output file:
; Encrypt/decrypt
MESS "Enter the encrypt/decrypt source: "
GET S1 60
MESS "Enter the encrypt/decrypt destination: "
GET S2 60
MESS "Enter the encrypt/decrypt password: "
GET S3 60
ENCRYPT S1 S2 S3 <SIM!AUT>
-or- DECRYPT S1 S2 S3
Alt-P Set comm parms
LEARN pops-up a window to select various comm settings
similar to Alt-P. To select a function, enter the number.
LEARN performs the function, and emits one or more
statements to the output file.
Alt-Z Toggle masking
LEARN toggles the 7 bit mask on Alt-Z. A SET MASK ON or SET
MASK OFF is added to the output file.
PgUp Upload
LEARN pops-up a window to select a protocol. To select one,
enter the number. If the protocol requires, a file name is
queried. If the transfer is successful, the following is
emitted to the output file:
; File transfer
[ MESS "Enter the file name: " ] If protocol
[ GET S1 60 ] requires
SENDFILE <method> [S1]
Version 1.0: 921012
COM-AND LEARN Script Page 10
IV. LEARN commands (continued)
PgDn Download
LEARN provides a download function on PgDn. Refer above to
PgUp for a description.
Alt-F10 Shell to DOS
Alt-F10 performs a shell-to-DOS. The output file is closed
during the SHELL. This allows editing of the output script
while it is being created. A SHELL command is not added to
the output file. Alt-F10 is provided only for convenience.
Alt-0/9 Send macro
LEARN transmits macros 0-9 in the usual manner. A "MACRO #"
statement is added to the output file.
NOTE: You may wish to add a WAITFOR prior to the emitted
MACRO statement.
Ctl-End Send break
LEARN emits a WAITFOR/BREAK to the output file, and then
sends a BREAK signal.
Ctl-Prt Toggle print
LEARN toggles the printer on Ctl-PrtSc. A "PRINTER ON" or
"PRINTER OFF" is added to the output file.
NOTE: You may wish to add a WAITFOR prior to the emitted
PRINTER statement.
Version 1.0: 921012
COM-AND LEARN Script Page 11
V. Modifying Scripts
LEARN.CMD is an ASCII file and must remain so for COM-AND. The
output file generated by LEARN is also an ASCII file. ASCII files
are prepared by text editors (e.g. COM-AND internal editor (Alt-Q),
or EDLIN). Word processors usually do not emit ASCII files... if a
word processor to change LEARN or its output, be sure it supports
ASCII output (often called non-document format).
The LEARN script itself is provided in two forms. LEARN.SRC is the
original source for LEARN with comments. LEARN.CMD has been stripped
of comments for execution speed. [Refer to the CACMP document.]
The LEARN.SRC file may be used as a resource for extending the
generated script. For example, the 'Ask_Name' subroutine is a
general purpose routine to pop-up a window, ask for a file name,
handle ESCape and report success/failure according to the response.
It might well be used instead of the MESSAGE/GET statements emitted
by LEARN before a SENDFILE or GETFILE.
Version 1.0: 921012
COM-AND LEARN Script Page 12
VI. Program requirements
COM-AND is written for an IBM PC or DOS compatible machine. COM-AND
does direct to screen buffer fetches and stores (unless BIOS screen
updates are directed using the /C switch or the Alt-O options menu).
COM-AND is TopView aware even without the /C switch or Alt-O option.
COM-AND supports MDA, CGA, EGA and Hercules. COM-AND uses a Micro-
soft Mouse if one is available.
COM-AND disk I/O is done through the 'Handle' oriented I/O routines
added to DOS 2.0. Therefore DOS 2.0 is a minimum requirement.
COM-AND (Version 2.9) requires 277K for itself. You need 384K
to take advantage of the DOS Gateway and to load accessories.
Version 1.0: 921012
COM-AND LEARN Script Page 13
VII. Author information
COM-AND was written using Microsoft Macro-Assembler. The author
likes assembler. Assembly language is an entirely appropriate
vehicle for some of the program, and a not-inappropriate vehicle
for the rest of it. Everything, in moderation...
The author of this program is R. Scott McGinnis of Chicago, IL.
GEnie and Delphi ID: TARTAN. CIS ID: 73147,2665. Comment and
suggestions (and criticism in moderation) are welcomed:
CABER Software
R. (Scott) McGinnis
P.O. Box 3607 Mdse Mart
Chicago, IL 60654-0607
I thank my wife, Elizabeth. We'll be having 'interesting times' very
soon now. I thank her for the wonderful times we've had so far.
This script (Version 1.0) may be distributed freely (but it isn't a
whole lot of use without COM-AND). Any improvements returned to the
author get attention... errors reported to the author are corrected.
COM-AND is shareware. If COM-AND is USED after a period of 30 days,
you MUST pay for it. [Please read REGISTER.DOC.]
Any hardware names and software names in this document are trademarks
or trade names of specific manufacturers.
Version 1.0: 921012